#include "config.h"
#include "opcode.h"
#include "service.h"

#ifdef _SERVER_
#include "./server/gateway.h"
#include "./server/service/login.h"
#include "./server/service/logout.h"
#else
#include "./client/gateway.h"
#include "./client/service/login.h"
#include "./client/service/logout.h"
#endif

Def::~Def()
{
	UNREG_HANDLERS();
}

Def::Def()
{
	REG_SERVICE(Login);
	REG_SERVICE(Logout);

#ifdef _SERVER_
	REG_OPCODE(OPCODE_CS_LOGIN, "OPCODE_CS_LOGIN", SERVICE_LOGIN);
	REG_OPCODE(OPCODE_CS_LOGOUT, "OPCODE_CS_LOGOUT", SERVICE_LOGOUT);

	REG_HANDLER(OPCODE_CS_LOGIN, &Gateway::ExecutePacket);
	REG_HANDLER(OPCODE_CS_LOGOUT, &Gateway::ExecutePacket);
#else
	REG_OPCODE(OPCODE_SC_LOGIN, "OPCODE_SC_LOGIN", SERVICE_LOGIN);

	REG_HANDLER(OPCODE_SC_LOGIN, &Login::HandleLogin);
#endif
}